Class com.symantec.itools.vcafe.openapi.ProjectFile
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.symantec.itools.vcafe.openapi.ProjectFile

Object
   |
   +----com.symantec.itools.vcafe.openapi.ProjectFile

public abstract class ProjectFile
extends Object
The API used to represent and access a Project File in a VisualProject. Each ProjectFile corresponds to an entry in the "Files" tab of Visual Cafe's project window. A plug-in can use the methods in this class to update file attributes. The implementation of all of ProjectFile's abstract methods first calls checkValidity(). Any method could therefore throw an InvalidProjectFileException. This exception extends RuntimeException, so doesn't have to be explicity declared or caught. A ProjectFile can become invalid if it is removed from its project, or its project is closed, and the corresponding ProjectListener message is ignored, for example.

Version:
1.0
Author:
Symantec Internet Tools Division
Since:
VCafe 3.0
See Also:
getProjectFiles, getProjectFiles(int), getProjectFile(String), getProjectFile(int), InvalidProjectFileException

Variable Index

 o ALL_FILE_ADDED
Specifies a file added by any source.
 o COMPILER_ADDED
Indicates this file was added by the compiler.
 o PARSER_ADDED
Indicates this file was added by the parser.
 o SHARED_DATABASE_ADDED
Indicates this file was added by the database.
 o UNKNOWN_ADDED
Indicates this file was added by an unknown source.
 o USER_ADDED
Indicates this file was added by the user.

Constructor Index

 o com.symantec.itools.vcafe.openapi.ProjectFile()

Method Index

 o checkValidity()
Checks that this object is valid, and throws a RuntimeException if not.
 o equals(ProjectFile)
Determine if two ProjectFile objects represent the same file in a VisualProject.
 o getClasses()
Gets an array of DTClass objects reflecting all the classes and interfaces declared in this ProjectFile.
 o getClosestClass(int)
Gets the closest class to the given ProjectFile location.
 o getClosestMember(int)
Gets the closest member to the given ProjectFile location..
 o getDeclaredClasses()
Gets an array of DTClass objects reflecting all the top-level classes and interfaces declared in this ProjectFile.
 o getFile()
Get the File that corresponds to this ProjectFile.
 o getFileAddedBy()
Determines who added this file to the project.
 o getFileId()
Gets a number that uniquely identifies this file within its project.
 o getFullName()
Gets the complete filename (including path) of the File associated with this ProjectFile.
 o getImports()
Determines the list of imports in this ProjectFile.
 o getPackageName()
Determines the package name for classes in this ProjectFile.
 o getProject()
Gets the VisualProject that owns this ProjectFile.
 o getSourceFile()
Get a SourceFile associated with this ProjectFile.
 o isRADEnabled()
Gets the Rapid Application Development (RAD) state of this ProjectFile.
 o isValid()
Determine if this ProjectFile corresponds to a valid file in its VisualProject.
 o remove()
Remove this ProjectFile from its VisualProject.
 o rename(String, boolean)
Renames this ProjectFile.
 o toString()
Gets a String representation of this ProjectFile.

Variables

 o ALL_FILE_ADDED
public static final int ALL_FILE_ADDED
Specifies a file added by any source.

 o COMPILER_ADDED
public static final int COMPILER_ADDED
Indicates this file was added by the compiler.

 o PARSER_ADDED
public static final int PARSER_ADDED
Indicates this file was added by the parser.

 o SHARED_DATABASE_ADDED
public static final int SHARED_DATABASE_ADDED
Indicates this file was added by the database.

 o UNKNOWN_ADDED
public static final int UNKNOWN_ADDED
Indicates this file was added by an unknown source.

 o USER_ADDED
public static final int USER_ADDED
Indicates this file was added by the user.

Constructors

 o ProjectFile
public ProjectFile()

Methods

 o checkValidity
public void checkValidity() throws InvalidProjectFileException
Checks that this object is valid, and throws a RuntimeException if not. Note that the implementation of all of ProjectFile's abstract methods first call checkValidity(). Any method could therefore throw an InvalidProjectFileException.

Throws: InvalidProjectFileException
 o equals
public abstract boolean equals(ProjectFile projectFile)
Determine if two ProjectFile objects represent the same file in a VisualProject.

Parameters:
projectFile - the ProjectFile to test against.
Returns:
true if the two ProjectFile objects represent the same file.
 o getClasses
public abstract com.symantec.itools.vcafe.openapi.dtreflect.DTClass[] getClasses()
Gets an array of DTClass objects reflecting all the classes and interfaces declared in this ProjectFile. This includes public, protected, default (package) access, and private classes and interfaces declared in the ProjectFile. This includes nested classes. To only get top-level classes (and not nested ones), use the getDeclaredClasses method.

Returns:
an array of DTClass objects for all ProjectFile classes.
See Also:
getDeclaredClasses
 o getClosestClass
public abstract com.symantec.itools.vcafe.openapi.dtreflect.DTClass getClosestClass(int location)
Gets the closest class to the given ProjectFile location. The closest class is the innermost class with a source range or Javadoc range that surrounds the given location.

Parameters:
location - the location offset, in zero-based bytes.
Returns:
the DTClass object of the closest class.
 o getClosestMember
public abstract com.symantec.itools.vcafe.openapi.dtreflect.DTMember getClosestMember(int location)
Gets the closest member to the given ProjectFile location.. The closest member is the member of the innermost class with a source range or Javadoc range that surrounds the given location.

Parameters:
location - the location offset, in zero-based bytes.
Returns:
the DTMember object of the closest member.
See Also:
getClosestMember
 o getDeclaredClasses
public abstract com.symantec.itools.vcafe.openapi.dtreflect.DTClass[] getDeclaredClasses()
Gets an array of DTClass objects reflecting all the top-level classes and interfaces declared in this ProjectFile. This includes public, protected, default (package) access, and private classes and interfaces declared in the ProjectFile. To also get nested classes, use the getClasses() method.

Returns:
an array of DTClass objects for top-level classes.
See Also:
getClasses
 o getFile
public abstract java.io.File getFile()
Get the File that corresponds to this ProjectFile. This method never returns null, but the actual file may not exist on disk (i.e. File.exists() == false).

 o getFileAddedBy
public abstract int getFileAddedBy()
Determines who added this file to the project.

Returns:
the source that added this file to the project, is a mask containing any of:
  • USER_ADDED - the file was added by the user.
  • COMPILER_ADDED - the file was added by the compiler.
  • PARSER_ADDED - the file was added by the parser.
  • UNKNOWN_ADDED - the file was added by an unknown source.
  • SHARED_DATABASE_ADDED - the file was added by the database.
 o getFileId
public abstract int getFileId()
Gets a number that uniquely identifies this file within its project.

Returns:
a unique numeric ID within the project.
 o getFullName
public abstract java.lang.String getFullName()
Gets the complete filename (including path) of the File associated with this ProjectFile.

Returns:
the complete filename of this ProjectFile.
 o getImports
public abstract java.lang.String[] getImports()
Determines the list of imports in this ProjectFile.

Returns:
the list of imports.
 o getPackageName
public abstract java.lang.String getPackageName()
Determines the package name for classes in this ProjectFile.

Returns:
the package name.
 o getProject
public abstract com.symantec.itools.vcafe.openapi.VisualProject getProject()
Gets the VisualProject that owns this ProjectFile.

Returns:
the owning VisualProject.
 o getSourceFile
public abstract com.symantec.itools.vcafe.openapi.SourceFile getSourceFile()
Get a SourceFile associated with this ProjectFile. This method never returns null, but the actual file may not exist on disk (i.e. SourceFile.getFile().exists() == false).

 o isRADEnabled
public abstract boolean isRADEnabled()
Gets the Rapid Application Development (RAD) state of this ProjectFile. This determines whether this ProjectFile is parsed for Rapid Application Development or not. It is shown by the 'Start RAD'/'Stop RAD' menu item in the project window.

Returns:
trueif RAD is enabled, false otherwise.
 o isValid
public abstract boolean isValid()
Determine if this ProjectFile corresponds to a valid file in its VisualProject. A ProjectFile can become invalid if it has been removed from its project, or its project has been closed, for example.

Returns:
true if the ProjectFile is still valid.
 o remove
public abstract void remove()
Remove this ProjectFile from its VisualProject.

 o rename
public abstract void rename(String newName,
                            boolean replace)
Renames this ProjectFile. The new file name must be fully qualified. This method optionally overwrites any existing file with the same new name. The old file with the original name is deleted. NOTE: This function assumes the file contents/type will remain the same. If it is a .java source file it will still be marked as a source file even if the extension changes. If you want to make sure that the file type in the build system is correct, remove the old file and add a new file instead.

Parameters:
newName - the new fully qualified name for this file.
replace - true to overwrite any file that might already have the new name.
 o toString
public java.lang.String toString()
Gets a String representation of this ProjectFile.

Returns:
the String, formatted as "ProjectFile[full path name]".
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index